<template>
    <el-scrollbar wrap-class="wrap-class" :always="false">
        <div class="vue-shop-vite-box">
            <h1>欢迎来到Vue Shop Vite</h1>
            <p>{{ tsData }}</p>
            <el-button type="primary" @click="testHandle">{{ $t('btn.test') }}</el-button>
            <el-button type="primary" round @click="changeLang('zhCn')">切换中文</el-button>
            <el-button type="primary" round @click="changeLang('en')">切换英文</el-button>
            <p v-for="item in 20" :key="item" class="scrollbar-demo-item">{{ item }}</p>
        </div>
    </el-scrollbar>
</template>

<script lang="ts" setup>
import { useTestData } from '../../store/test'
import { useLangStore } from '../../store/i18nConfig'
import { onMounted } from 'vue'
import { storeToRefs } from 'pinia'
defineOptions({
    name: 'Home'
})
const testData = useTestData()
const { tsData } = storeToRefs(testData)
const { testHandle } = testData

const langStore = useLangStore()
const { changeLang } = langStore

onMounted(() => {
    console.log('来到了首页里面哦')
})
</script>

<style scoped>
.scrollbar-demo-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    margin: 10px;
    text-align: center;
    border-radius: 4px;
    background: var(--el-color-primary-light-9);
    color: var(--el-color-primary);
}
</style>